<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
  </head>
  <body>
    <form action="">
      账号: <input type="text" name="account" />
      <br />
      密码: <input type="text" name="pwd" /> <br />
      <input type="button" value="登录" />
    </form>
    <script>
      $(function () {
        $('input[value="登录"]').click(function () {
          let account = $('[name="account"]').val();
          let pwd = $('[name="pwd"]').val();
          // 进行判断
          let msg = [];
          if (account.length < 3) {
            msg.push('您输入的账号长度无效');
          }
          if (account.length < 3) {
            msg.push('您输入的密码长度无效');
          }
          if (msg.length > 0) {
            alert(msg.join(''));
          } else {
            
          }
        });
      });
    </script>
  </body>
</html>
